#include <iostream>
#include <vector>
using namespace std;

int main()
{
	vector<int> v1;
	v1.push_back(1);
//	v1.push_back(2);
//	v1.push_back(3);
//	v1.push_back(4);
	
	vector<int>::iterator it = v1.begin();
	auto it2 = v1.end();
	
	while (it != v1.end())
	{
		it = v1.erase(it);
		cout << v1.size() << endl;
		//cout << v1.end() << endl;
		//++it;
	}
	
	cout << *it << endl; // expecting result: null
	
//	cout << *(it+1) << endl;
//	cout << *it << endl;
//	cout << v1.size() << endl;
//	cout << v1[1] << endl; // 越界访问!!!!
	
	return 0;
}
